/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.edu.kamai.utility;

/**
 *
 * @author xyzhu
 */
public class countTimer implements Runnable{

    public countTimer(){
        count = 0;
    }

    public int getHours() {
        return hours;
    }

    public int getMinutes() {
        return minutes;
    }

    public int getSeconds() {
        return seconds;
    }

    public String getMsg() {
        return msg;
    }
    
    
    
    @Override
    public void run() {
        while(true){
            hours = (int)(count / 3600000);
            minutes = (int)((count - hours * 3600000) / 60000);
            seconds = (int)((count - hours * 3600000 - minutes * 60000) / 1000);
            
            
            
            count++;
            try{
                Thread.sleep(1);
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    
    private long count;
    int ms, seconds, minutes, hours;
    String msg;
    
    public static void main(String[] args) {
        System.out.println("i am here");
        countTimer ct = new countTimer();
        Thread thread = new Thread(ct);
        thread.start();
        
        System.out.println("i am here");
        int h = ct.getSeconds();
        System.out.println(h);
        try{
            Thread.sleep(1000); 
        }catch(Exception ex){
            ex.printStackTrace();
        }
        for(int i=0;i<100;i++){
            h = ct.getSeconds();
            System.out.println(h);
        }
    }
}
